<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <li>01</li>
  <li>02</li>
  <li>03</li>
  <li>04</li>
  <li>05</li>
  <li>06</li>
  <li>07</li>
  <li>08</li>
  <li>09</li>
  <li>10</li>
</body>
<script>
  // 扩展运算符 ...
  // 作用: 可以用来展开数组和对象

  // 展开数组  => 得到逗号分隔的参数序列(不能直接用 => 1. 作为函数的参数 2.放到新数组)
  var list = [2, 8, 4, 6, 5, 3, 9, 7, 1];

  console.log(...list);  // ...list => 2,8,4,6,5,3,9,7,1

  var min = Math.min(...list); // Math.min(2,8,4,6,5,3,9,7,1);
  console.log(min);

  // 用法拓展(数组和伪数组)
  // 1. 数组的深复制
  var list = [2, 8, 4, 6, 5, 3, 9, 7, 1];
  var arr = [...list];
  console.log(arr, list);
  console.log(arr === list);

  // 2. 伪数组转真数组
  var liList = document.getElementsByTagName("li");
  var arr = [...liList];
  console.log(arr, liList);
  console.log(Array.isArray(arr));

  // 3. 数组合并
  var a = [1, 2, 3];
  var b = [4, 5, 6];
  var arr = [...a, ...b];
  console.log(arr);

</script>

</html>